/*
 * @Author: lineCode
 * @Date: 2024-12-27 13:38:13
 * @LastEditors: lineCode 1145938682@qq.com
 * @LastEditTime: 2025-08-28 22:32:32
 * @FilePath: /backend/shorthand-modules/shorthand-modules-content/src/main/java/com/angus/modules/content/vo/SysOrderVo.java
 */
package com.angus.modules.content.vo;


import com.angus.modules.content.domain.SysOrder;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
public class SysOrderVo {

    private String orderNo;

    /** 客户ID */
    private Long userId;

    /** 课程CODE */
    private String courseCode;

    /** 课程名称*/
    private String courseName;

    /** 课程类型 */
    private String courseType;

    /** 付款金额 */
    private BigDecimal courseAmount;

    /** 状态 */
    private Integer status;

    /** 支付方式 */
    private String payMethod;

    /** 支付时间 */
    private LocalDateTime payTime;

    /** 推荐码 */
    private String recommendCode;

    /** 订单创建时间 */
    private LocalDateTime createTime;

    /** 有效期 */
    private LocalDateTime expireTime;

    /**
     * 课程佣金分成比例：课程价格 * 佣金比例 = 佣金金额
     */
    private BigDecimal commissionRate;

    /** 客户昵称 */
    private String nickName;

    public static List<SysOrderVo> mapToVo(List<SysOrder> sysOrder){
        List<SysOrderVo> sysOrderVoList = new java.util.ArrayList<>();
        for (SysOrder order : sysOrder) {
            SysOrderVo sysOrderVo = new SysOrderVo();
            sysOrderVo.setOrderNo(order.getOrderNo());
            sysOrderVo.setUserId(order.getUserId());
            sysOrderVo.setCourseCode(order.getCourseCode());
            sysOrderVo.setCourseName(order.getCourseName());
            sysOrderVo.setCourseType(order.getCourseType());
            sysOrderVo.setCourseAmount(order.getCourseAmount());
            sysOrderVo.setStatus(order.getStatus());
            sysOrderVo.setPayMethod(order.getPayMethod());
            sysOrderVo.setPayTime(order.getPayTime());
            sysOrderVo.setRecommendCode(order.getRecommendCode());
            sysOrderVo.setCreateTime(order.getCreateTime());
            sysOrderVo.setExpireTime(order.getExpireTime());
            sysOrderVo.setCommissionRate(order.getCommissionRate());
            // 添加nickName字段的映射
            sysOrderVo.setNickName(order.getNickName());
            sysOrderVoList.add(sysOrderVo);
        }
        return sysOrderVoList;
    }
}
